package com.yeswater.multithread.chapter2.test2_2.test2;

import java.util.concurrent.TimeUnit;

/**
 * author : yeswater
 * date : 2023/10/20
 */

public class ObjService {

    public void serviceMethod() {
        try {
            synchronized (this) {
                System.out.println("begin time=" + System.currentTimeMillis());
                TimeUnit.SECONDS.sleep(2);
                System.out.println("  end time=" + System.currentTimeMillis());
            }
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

}
